package cn.edu.zut.response;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author Davey chan
 */
//*响应字节数据：设置字符数据的响应体
// */
@WebServlet("/resp3")
public class responseDemo3 extends HttpServlet {
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//设置字符的类型和解码的方式
        response.setContentType("text/html;charset=utf-8");
// 1,获取字符输出流
        PrintWriter writer = response.getWriter();
//        2,输出
        writer.write("<H1>你好<h1>");

    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }


}
